<template>
    <el-switch
        v-model="disable"
        inline-prompt
        active-text="启用"
        inactive-text="禁用"
        @change="
            () => {
                emit('change', disable ? 0 : 1)
            }
        "
    />
</template>
<script setup lang="ts">
import { ref, watchEffect } from 'vue'
const props = defineProps(['status'])
const emit = defineEmits(['change'])
const disable = ref(false)

watchEffect(() => {
    disable.value = Number(props.status) === 0 ? true : false
})
</script>
